配置Gitlab pipeline

啟動Runner之後需要配置.gitlab-ci.yaml文件,來定義pipeline。

項目構建需要透過pipeline來控制流程,具體配置pipeline可以參考這篇通过 .gitlab-ci.yml 配置任务

1. Build .gitlab-ci.yml

在project中新建.gitlab-ci.yml文件。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
stages:

- build

before_script:
- echo 'This is before_script'

after_script:
- echo 'This is after_script'


job1:

stage: build

script:

- echo 'This is Job1'

tags:

except:

- tags

job2:

stage: build

script:

- systeminfo

tags:

except:

- tags

2. Push .gitlab-ci.yml

1
2
3
git add .
git commit -m "加入 .gitlab ci"
git push origin master

3. Push之後會自動構建項目

查看構建歷史

查看輸出日誌